import React from 'react';
import {Link} from 'react-router-dom';
import { Button } from 'antd/lib/radio';

import "../css/login.css";
import UserService from '../service/user';

// export default class Login extends React.Component {
//     render = () =>
//         (<div className="login-page">
//             <div className="form">
//                 <form className="login-form">
//                     <input type="text" placeholder="邮箱" />
//                     <input type="password" placeholder="密码" />
//                     <button>登录</button>
//                     <p className="message">还未注册？<Link to="/reg">请注册.</Link></p>
//                 </form>
//             </div>Í
//         </div>);
// }


const service = new UserService();

export default class Login extends React.Component {
    render () {
        return (
            <_Login service={service} />
        );
    };
};

class _Login extends React.Component {

    handleClick(event) {
        event.preventDefault();
        console.log(event.target);
        let fm = event.target.form;
        // console.log(1);
        console.log("~~~~~~~~~~~~~~~");
        let ret = this.props.service.login(fm[0].value, fm[1].value)
    } 


    render() {
        console.log("---------------");
        return (
        <div className="login-page">
            <div className="form">
                <form className="login-form">
                    <input type="text" placeholder="邮箱" />
                    <input type="passowrd" placeholder="密码" />
                    <button onClick={this.handleClick.bind(this)}>登陆</button>
                    <p className="message">还未注册?<Link to="/reg">请注册</Link></p>
                </form>
            </div>
        </div>
    )}
}